pipeline {
    agent any
    
	environment {
		GIT_URL = ""
		REMOTE_DIRECTORY = ""
		REMOVE_PREFIX = ""
		SOURCE_FILES = ""
		CREDENTIALSID = ""
		CONFIG_NAME = ""
	}
    
    stages {
        stage('拉取代码') {
            steps {
                echo '拉取代码'
                checkout scmGit(branches: [[name: "${branch}"]], extensions: [], userRemoteConfigs: [[credentialsId: "${CREDENTIALSID}", url: "${GIT_URL}"]])
            }
        }
        
		
        
        stage('发送服务器启动服务') {
            steps {
                echo '发送服务器启动服务'
                sshPublisher(publishers: [sshPublisherDesc(configName: "${CONFIG_NAME}", transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: " cd ${REMOTE_DIRECTORY} && sh deploy.sh restart ", execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: "${REMOTE_DIRECTORY}", remoteDirectorySDF: false, removePrefix: "${REMOVE_PREFIX}", sourceFiles: "${SOURCE_FILES}")], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
            }
        }
        
        
    }
}